package com.itheima.d4_create_thread;

/**
 * 目标：掌握多线程的创建方式二：实现Runnable接口。
 */
public class ThreadTest2 {
    public static void main(String[] args) {
        Thread thread = new Thread(new MyRunnable("小帅"));
        Thread thread1 = new Thread(new MyRunnable("ekai"));
        thread.start();
        thread1.start();
        for (int i = 0; i < 1000; i++) {
            System.out.println(i);
        }
    }
}

class MyRunnable implements Runnable {
    private String name;

    public MyRunnable(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        for (int i = 0; i < 999; i++) {
            System.out.println(name + i);
        }
    }
}